import db from "../utils/db"

export function getAdjustDataById (id) {
  return db.adjustData.get(id);
}

export function updateAdjustDataById (id, data) {
  return db.adjustData.update(id, data);
}

export function getAllAdjustData() {
  return db.adjustData.toArray();
}

export function addOrUpdateAdjustData(item) {
  if (item.id === undefined || item.id === "" || item.id === null) {
    delete item["id"]
    db.adjustData.add(item);
  } else {
    db.adjustData.put(item);
  }
}

export function deleteAdjustDataById(id) {
   db.adjustData.delete(id);
}

export function deleteAdjustDataByConditionEqual(condition, value) {
  return db.adjustData.where(condition).equals(value).delete();
}
